A quaternion, symbolizing rotations as a 4D vector. More...
Public Member Functions | |
| Quaternion () | |
| Quaternion (float x, float y, float z, float w) | |
| Quaternion (const Vector &axis, float angle) | |
| Quaternion (const Vector &eulerAngles) | |
| Quaternion (const Matrix &mat) | |
| Quaternion (const Quaternion &other) | |
| ~Quaternion () | |
| Vector | getAsEulerAngles () const |
| Quaternion & | setFromAxisAngle (const Vector &axis, float angle) |
| Quaternion & | setFromEuler (const Vector &angles) |
| Quaternion & | setFromOrientationMatrix (const Matrix &mat) |
| Quaternion & | setFromTransformationMatrix (const Matrix &mat) |
| Vector | transform (const Vector &vector) const |
| Vector & | apply (Vector &vector) const |
| void | fromString (const nkMemory::StringView &str) |
| Quaternion & | operator= (const Quaternion &other) |
| Vector | operator* (const Vector &other) const |
| Quaternion | operator* (const Quaternion &other) const |
| void | operator*= (const Quaternion &other) |
| bool | operator== (const Quaternion &other) const |
Public Attributes | |
| float | _x |
| X component of the quaternion. | |
| float | _y |
| Y component of the quaternion. | |
| float | _z |
| Z component of the quaternion. | |
| float | _w |
| W component of the quaternion. | |
A quaternion, symbolizing rotations as a 4D vector.
The equation for the quaternion is considered as : xi + yj + zk + w.
| nkMaths::Quaternion::Quaternion | ( | ) |
Default constructor. Defaults to (0, 0, 0, 1), encoding no rotation.
| nkMaths::Quaternion::Quaternion | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | w | ||
| ) |
Filling constructor.
| x | The x component. |
| y | The y component. |
| z | The z component. |
| w | The w component. |
| nkMaths::Quaternion::Quaternion | ( | const Vector & | axis, |
| float | angle | ||
| ) |
Axis angle constructor.
| axis | The axis of rotation to consider. |
| angle | The angle around this axis, in radians. |
| nkMaths::Quaternion::Quaternion | ( | const Vector & | eulerAngles | ) |
Euler angles constructor.
| eulerAngles | The euler angles, considering rotation in ZYX (Yaw-Pitch-Roll) order. |
| nkMaths::Quaternion::Quaternion | ( | const Matrix & | mat | ) |
Matrix constructor.
| mat | The matrix from which to extract the rotation. |
| nkMaths::Quaternion::Quaternion | ( | const Quaternion & | other | ) |
Copy constructor.
| other | The quaternion to copy. |
| nkMaths::Quaternion::~Quaternion | ( | ) |
Destructor.
| Vector nkMaths::Quaternion::getAsEulerAngles | ( | ) | const |
| Quaternion& nkMaths::Quaternion::setFromAxisAngle | ( | const Vector & | axis, |
| float | angle | ||
| ) |
Sets the quaternion from an axis and angle pair.
| axis | The axis to rotate around. |
| angle | The angle to rotate, in radians. |
| Quaternion& nkMaths::Quaternion::setFromEuler | ( | const Vector & | angles | ) |
Sets the quaternion from euler angles.
| angles | The euler angles to translate, considering rotation in ZYX (Yaw-Pitch-Roll) order. |
| Quaternion& nkMaths::Quaternion::setFromOrientationMatrix | ( | const Matrix & | mat | ) |
Sets the quaternion from a rotation matrix.
| mat | The matrix to extract the rotation from. |
| Quaternion& nkMaths::Quaternion::setFromTransformationMatrix | ( | const Matrix & | mat | ) |
Sets the quaternion from a full transformation matrix.
| mat | The matrix to extract the rotation from. |
Rotates a vector, by copying it and returning it. Another way to express q * v.
| vector | The vector to rotate. |
Rotates a vector, by altering the vector parameter. Another way to express q *= v.
| vector | The vector to rotate. |
| void nkMaths::Quaternion::fromString | ( | const nkMemory::StringView & | str | ) |
Parse components from a string. Format is "x,y,z,w".
| str | The string to parse. |
| Quaternion& nkMaths::Quaternion::operator= | ( | const Quaternion & | other | ) |
Assignment operator.
| other | The quaternion to assign. |
Multiplication operator.
| other | The vector to apply the quaternion to. |
| Quaternion nkMaths::Quaternion::operator* | ( | const Quaternion & | other | ) | const |
Multiplication operator.
| other | The quaternion to multiply with. |
| void nkMaths::Quaternion::operator*= | ( | const Quaternion & | other | ) |
Multiplication and assignment operator.
| other | The quaternion to multiply with. |
| bool nkMaths::Quaternion::operator== | ( | const Quaternion & | other | ) | const |
Comparison operator.
| other | The quaternion to compare with. |